import request from './request'
import type { ApiResponse } from './request'

export interface EmailRequest {
  to: string
  subject: string
  recipientName?: string
  message: string
}

export interface ProductEmailRequest {
  to: string
  productId: number
  recipientName?: string
}

/**
 * 发送简单邮件
 */
export const sendSimpleEmail = (data: EmailRequest): Promise<ApiResponse<string>> => {
  return request<string>({
    url: '/email/simple',
    method: 'post',
    data,
  })
}

/**
 * 发送自定义邮件
 */
export const sendCustomEmail = (data: EmailRequest): Promise<ApiResponse<string>> => {
  return request<string>({
    url: '/email/send-custom',
    method: 'post',
    data,
  })
}

/**
 * 发送产品信息邮件
 */
export const sendProductEmail = (data: ProductEmailRequest): Promise<ApiResponse<string>> => {
  return request<string>({
    url: '/email/send-product',
    method: 'post',
    data,
  })
}
